<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.tjsinfo.tjsoa.system.vo.User"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="com.tjsinfo.tjsoa.addresslist.vo.AddressListSystemUser"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>粮油集团办公自动化协作平台</title>
    <meta http-equiv="x-ua-compatible" content="ie=7" />
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	
	<link href="<%=basePath%>style/txlz7.css" rel="stylesheet" type="text/css" id="txlz7"/>
	
	<link rel="stylesheet" type="text/css"
			href="<%=basePath%>ajaxFramework/ext-2.1/resources/css/ext-all.css" />
		
	<%
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
		User user = (User)session.getAttribute("user");
		String returnString = (String)request.getAttribute("returnString");
		if(returnString == null)returnString="";
		String moduleType = (String)request.getAttribute("moduleType");
		AddressListSystemUser listUser = (AddressListSystemUser)request.getAttribute("listUser");
		String id = String.valueOf(listUser.getUserId());
		String userName = "";
		String mobile = "";
		String email = "";
		String company = "";
		String sector = "";
		String duty = "";
		String companyPhone = "";
		String companyFax = "";
		String companyAddress = "";
		String companyPostal = "";
		String homeAddress = "";
		String homePostal = "";
		String homePhone = "";
		String birthday = "";
		String qq = "";
		String msn = "";
		String blog = "";
		String remarks = "";
		if(listUser.getUserName() != null)userName = listUser.getUserName();
		if(listUser.getMobile() != null)mobile = listUser.getMobile();
		if(listUser.getEmail() != null)email = listUser.getEmail();
		if(listUser.getCompany() != null)company = listUser.getCompany();
		if(listUser.getSector() != null)sector = listUser.getSector();
		if(listUser.getDuty() != null)duty = listUser.getDuty();
		if(listUser.getCompanyPhone() != null)companyPhone = listUser.getCompanyPhone();
		if(listUser.getCompanyFax() != null)companyFax = listUser.getCompanyFax();
		if(listUser.getCompanyAddress() != null)companyAddress = listUser.getCompanyAddress();
		if(listUser.getCompanyPostal() != null)companyPostal = listUser.getCompanyPostal();
		if(listUser.getHomeAddress() != null)homeAddress = listUser.getHomeAddress();
		if(listUser.getHomePostal() != null)homePostal = listUser.getHomePostal();
		if(listUser.getHomePhone() != null)homePhone = listUser.getHomePhone();
		if(listUser.getBirthday() != null){
			birthday = sdf.format(listUser.getBirthday());
		}
		if(listUser.getQq() != null)qq = listUser.getQq();
		if(listUser.getMsn() != null)msn = listUser.getMsn();
		if(listUser.getBlog() != null)blog = listUser.getBlog();
		if(listUser.getRemarks() != null)remarks = listUser.getRemarks();
	 %>
	 <style>
			 td {
				font:12px/170% "宋体", "新宋体", "黑体"; color:#000
			}
			th {
				font:12px/170% "宋体", "新宋体", "黑体"; color:#000
			}
			
			.ErrorDiv {
			display: none;
			position: absolute;
			border: 1px solid #FFF;
			border-bottom:none;
			z-index:1002;
			overflow: auto;
		}
		
		.black_overlays{
			display: block;
			position: absolute;
			top: 0%;
			left: 0%;
			width: 100%;
			height: 100%;
			background-color: #C1EBFC;
			z-index:1002;
			-moz-opacity: 0.8;
			opacity:.80;
			filter: alpha(opacity=30);
		}
		.shaodeng {
			display: none;
			position: absolute;
			border: 1px solid #FFF;
			border-bottom:none;
			z-index:1002;
			overflow: auto;
		}
		.lan01{
background: url(<%=basePath%>images/lanbg01.gif) no-repeat 0 0; width:6px; height:24px;} 
.lan02{
background: url(<%=basePath%>images/lanbg02.gif) repeat-x; width:99%; height:24px;}            
.lan03{
background: url(<%=basePath%>images/lanbg03.gif) no-repeat; width:8px; height:24px;}             
.cha{
padding-top:3px}
	 </style>
	<script type='text/javascript' src='<%=basePath%>dwr/interface/AddressListGroupBo.js'></script>
	<script type='text/javascript' src='<%=basePath%>dwr/interface/AddressListGroupBo.js'></script>
	<script type='text/javascript' src="<%=basePath%>dwr/engine.js"></script>
	<script type='text/javascript' src="<%=basePath%>dwr/util.js"></script>
	 
	<script type="text/javascript" src="<%=basePath%>ajaxFramework/ext-2.1/adapter/ext/ext-base.js"></script>
	<script type="text/javascript" src="<%=basePath%>ajaxFramework/ext-2.1/ext-all-debug.js"></script>
	<script type="text/javascript" src="<%=basePath%>ajaxFramework/ext-2.1/states.js"></script>
		
	<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/ext-all.js"></script>
	<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/source/locale/ext-lang-zh_CN.js"></script>
	
	<script type="text/javascript" src="<%=basePath %>js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
	function checkAllTextValid(form)  
	{  
	    //记录不含引号的文本框数量  
		var resultTag = 0;  
		//记录所有text文本框数量  
		var flag = 0;  
		for(var i = 0; i < form.elements.length; i ++)  
		{  
		 if(form.elements[i].type=="text")  
		 {  
		     flag = flag + 1;  
		  //此处填写所要过滤的特殊符号  
		  //注意：修改####处的字符，其它部分不许修改.  
		  //if(/^[^####]*$/.test(form.elements[i].value))  
		  if(/^[^\|"'<>]*$/.test(form.elements[i].value)) resultTag = resultTag+1;  
		  else form.elements[i].select();  
		 }  
		}
		//如果含引号的文本框等于全部文本框的值，则校验通过  
		if(resultTag == flag) return true;  
		else 
		{  
		 Ext.MessageBox.alert('提示框',"<nobr>文本框中不能含有<br/> 1 单引号: ' <br/> 2 双引号: \" <br/> 3 竖  杠: | <br/> 4 尖角号: < > <br/><br/>请检查输入！</nobr>");  
		 return false;  
		}  
	}
	function shaodeng(){
		document.getElementById("shaodeng").style.top = document.body.clientHeight/3;
		document.getElementById("shaodeng").style.left = document.body.clientWidth/3;
		document.getElementById("shaodeng").style.display = "block";
	}
	
	function huifu(){
		document.getElementById("shaodeng").style.display = "none";
		document.getElementById("blackdiv").style.display = "none";
	}
	
	function submitform1(){
		if(document.getElementById('userName').value == null || document.getElementById('userName').value == ''){
			Ext.MessageBox.alert('提示框','<nobr>请填入联系人姓名</nobr>');
		}else{
			if(checkAllTextValid(document.form1))document.form1.submit();
		}
	}
	
	function yanhomePhone(){
		var zhengze = /^[0-9\-]{0,20}$/;
		if(!zhengze.exec(document.getElementById('homePhone').value) && document.getElementById('homePhone').value!=''){
			Ext.MessageBox.alert('提示框','<nobr>家庭电话输入只能为数字、-,且最多20位</nobr>');
			document.getElementById('homePhone').value = '';
			return false;
		}
	}
	
	function yancompanyPhone(){
		var zhengze = /^[0-9\-]{0,20}$/;
		if(!zhengze.exec(document.getElementById('companyPhone').value) && document.getElementById('companyPhone').value!=''){
			Ext.MessageBox.alert('提示框','<nobr>公司电话输入只能为数字、-,且最多20位</nobr>');
			document.getElementById('companyPhone').value = '';
		}
	}
	
	function yancompanyFax(){
		var zhengze = /^[0-9\-]{0,20}$/;
		if(!zhengze.exec(document.getElementById('companyFax').value) && document.getElementById('companyFax').value!=''){
			Ext.MessageBox.alert('提示框','<nobr>公司传真输入只能为数字、-,且最多20位</nobr>');
			document.getElementById('companyFax').value = '';
		}
	}
	
	function yanNumLength(id,name,length){
		var str = document.getElementById(id).value;
		if(str!=''){
		if(!isNaN(str)){
			if(str.length > length){
				Ext.MessageBox.alert('提示框','<nobr>'+name+'输入只能为数字且最多'+length+'位</nobr>');
				document.getElementById(id).value = '';
			}
		}else{
			Ext.MessageBox.alert('提示框','<nobr>'+name+'输入只能为数字且最多'+length+'位</nobr>');
			document.getElementById(id).value = '';
		}
		}
	}
	function yanlength(id,name,lenth){
		var str = document.getElementById(id).value;
		if(str!=''){
		if(str.length > lenth){
			Ext.MessageBox.alert('提示框','<nobr>'+name+'的长度只能为'+lenth+'以内</nobr>');
			document.getElementById(id).value = '';
		}
		}
	}
	
	function yanemail(){
		var str = document.getElementById('email').value;
		if(!checkMail(str) && str!=''){
			Ext.MessageBox.alert('提示框','<nobr>E-Mail格式不正确</nobr>');
			document.getElementById('email').value = '';
			return false;
		}
		return true;
	}

function closeErrorDiv(){
		document.getElementById("blackdiv").style.display = "none";
		document.getElementById("ErrorDiv").style.display = "none";
	}
	
	function xianshiErrorDiv(){
		document.getElementById("ErrorDiv").style.top = document.body.clientHeight/4;
		document.getElementById("ErrorDiv").style.left = document.body.clientWidth/8;
		document.getElementById("blackdiv").style.display = "block";
		document.getElementById("ErrorDiv").style.display = "block";
	}
/**
 * @param eml {String}
 */
function checkMail(eml){
	if(!/^[\.\w]([(\/)(\-)(\+).\w])*@([(\-)\w]{1,64}\.){1,7}[(\-)\w]{1,64}$/.test(eml)){
		return false;
	}else{
		if(eml && eml != "" && (eml.indexOf("@") != -1)){
			var p = eml.indexOf("@");
			var name = eml.substring(0, p);
			if(name.length >64 || eml.length > 256){
				return false;
			}else{
				return true;
			}
		}
	}
	return false;
}

window.onload = function(){
	document.getElementById("right").style.height = document.body.clientHeight;
	document.getElementById("zongdiv").style.height = document.body.clientHeight-50;
	huifu();
	var tb = new Ext.Toolbar(
		{
			height:25
		}
	);

    tb.render('menu');
	tb.add(
    {
            text:'确定',
            iconCls: 'daohang',
        	handler: function(){
        		submitform1();
			}
  
    }
    );
	tb.addFill();
    tb.addText('<img id="windowResize" src="<%=basePath%>images/m_icon05.gif;"><a style="font-weight:bold; color:black;line-height: 22px;">修改本人联系信息</a>&nbsp;&nbsp;&nbsp;');
}
</script>
  </head>
  
  <body>
  <div id="right" style="width: 99%;">
  	<div id="menu" style="padding-top:4px;"></div>
      <div class="contact_content" id="zongdiv">
      <form action="<%=basePath %>tjsinfo/tjsoa/addresslist/updateTjsUser.do" name="form1" method="post">
      <input type="hidden" name="moduleType" id="moduleType" value="<%=moduleType %>"/>
         <table width="99%" height="90%" border="0" cellspacing="0" cellpadding="0" align="center" >
              <tr>
                <td width="10%" align="center" valign="middle"><img src="<%=basePath%>images/basicicon.gif" /></td>
                <td colspan="2"><table width="90%" border="0" cellspacing="0" cellpadding="0" align="left">
                                      <tr>
                                        <td width="50%">姓&nbsp;&nbsp;&nbsp;&nbsp;名:
                <input id="userName" name="userName" value="<%=userName %>" type="text" size="40" style="border:1px #ddd solid;background:#F4F4F4" onchange="yanlength('userName','联系人姓名',50)"/></td>
                                        <td width="50%">手&nbsp;&nbsp;&nbsp;&nbsp;机:
                <input id="mobile" name="mobile" value="<%=mobile %>" type="text" size="40" style="border:1px #ddd solid;background:#F4F4F4" onchange="yanNumLength('mobile','手机',15)"/></td>
                                      </tr>
                                      <tr>
                                        <td width="50%">办公电话:
                <input id="companyPhone" name="companyPhone" value="<%=companyPhone %>" type="text" size="40" style="border:1px #ddd solid;background:#F4F4F4" onchange="yancompanyPhone()"/></td>
						                <td width="50%">是否公布:
						                <select name="remarks" id="remarks">
						                	<option value="否" <%if("否".equals(listUser.getRemarks()))out.print("selected"); %>>否</option>
						                	<option value="是" <%if("是".equals(listUser.getRemarks()))out.print("selected"); %>>是</option>
						                </select>
						                </td>
                                      </tr>
                                </table>              </td>
              </tr>
              <tr>
                <td colspan="3" height="2" background="<%=basePath%>images/line02.gif"></td>
              </tr>
              <tr>
                <td width="10%" align="center" valign="middle"><img src="<%=basePath%>images/contacticon.gif" /></td>
                <td colspan="2">
                          <table width="90%" border="0" cellspacing="0" cellpadding="0" align="left">
                                      <tr>
                                        <td width="50%">工作单位:
                <input id="company" name="company" value="<%=company %>" type="text" size="41" style="border:1px #ddd solid;background:#F4F4F4" onchange="yanlength('company','工作单位',50)"/></td>
                                        <td width="50%">部&nbsp;&nbsp;&nbsp;&nbsp;门:
                <input id="sector" name="sector" value="<%=sector %>" type="text" size="40" style="border:1px #ddd solid;background:#F4F4F4" onchange="yanlength('sector','部门',50)"/></td>
                                      </tr>
                                      <tr>
                                        <td width="50%">职&nbsp;&nbsp;&nbsp;&nbsp;务:
                <input id="duty" name="duty" value="<%=duty %>" type="text" size="41" style="border:1px #ddd solid;background:#F4F4F4" onchange="yanlength('duty','职务',25)"/></td>
                                        <td width="50%">&nbsp;</td>
                                      </tr>
                                      <tr>
                                        <td width="50%">传&nbsp;&nbsp;&nbsp;&nbsp;真:
                <input id="companyFax" name="companyFax" value="<%=companyFax %>" type="text" size="41" style="border:1px #ddd solid;background:#F4F4F4" onchange="yancompanyFax()"/></td>
                                        <td width="50%">地&nbsp;&nbsp;&nbsp;&nbsp;址:
                <input id="companyAddress" name="companyAddress" value="<%=companyAddress %>" type="text" size="40" style="border:1px #ddd solid;background:#F4F4F4" onchange="yanlength('companyAddress','公司地址',75)"/></td>
                                      </tr>
                          </table>                </td>
              </tr>
              <tr>
                <td colspan="3" height="2" background="<%=basePath%>images/line02.gif"></td>
              </tr>
              <tr>
                <td width="10%" align="center" valign="middle"><img src="images/houseicon.gif" /></td>
                <td colspan="2"> 
                            <table width="90%" border="0" cellspacing="0" cellpadding="0" align="left">
                                      <tr>
                                        <td width="50%">住宅地址:
                <input id="homeAddress" name="homeAddress" value="<%=homeAddress %>" type="text" size="41" style="border:1px #ddd solid;background:#F4F4F4" onchange="yanlength('homeAddress','住宅地址',75)"/></td>
                                        <td width="50%">住宅电话:
                <input id="homePhone" name="homePhone" value="<%=homePhone %>" type="text" size="40" style="border:1px #ddd solid;background:#F4F4F4" onchange="yanhomePhone()"/></td>
                                      </tr>
                             </table>                </td>
              </tr>
              <tr>
                <td colspan="3" height="2" background="<%=basePath%>images/line02.gif"></td>
              </tr>
              <tr>
                <td width="10%" align="center" valign="middle"></td>
                <td colspan="2">
                         <table width="90%" border="0" cellspacing="0" cellpadding="0" class="tabbbb" align="left">
                         </table>                </td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td colspan="2">&nbsp;</td>
              </tr>
         </table>
        </form>
  </div>
</div>
<div class="shaodeng" id="shaodeng">
	<table width="478" border="0" cellpadding="0" cellspacing="0" >
               <tr>
                 <td height="24" align="left">
                 <b>请求正在处理中,请稍候....</b>
                 </td>
               </tr>
             </table>
</div>
<div id="blackdiv" class="black_overlays">
	<iframe style="width:100%;height:100%;filter:alpha(opacity=0);-moz-opacity:0"></iframe>
</div>
<script type="text/javascript">
	<%
		if(returnString!=null && !"".equals(returnString)){
	%>
	Ext.MessageBox.alert('提示框','<nobr>修改成功</nobr>');
	<%
		}
	%>
</script>
  </body>
</html>
